package com.ys.erp.stage_user_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;
import com.ys.erp.framework.response.PageDTO;
import com.ys.erp.stage_user_service.bean.condition.UserComplaintCondition;
import com.ys.erp.stage_user_service.bean.vo.ComplaintVO;
import com.ys.erp.stage_user_service.bean.vo.StrongComplaintVO;
import com.ys.erp.stage_user_service.service.UserComplaintService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * @author lwj
 * @date 2023/12/18
 */

@RestController
@RequiredArgsConstructor
@RequestMapping("/manage/user/complaint")
@Tag(name = "用户客诉相关接口", description = "用户客诉相关接口")
@ResponseResult
public class UserComplaintController {


    private final UserComplaintService userComplaintService;


    @PostMapping("/pageComplaint")
    @Operation(description = "分页用户客诉")
    @CheckEmpLogin
    public PageDTO<ComplaintVO> pageComplaint(@RequestBody @Valid UserComplaintCondition.PageComplaintCon con, @StageLoginEmp StageEmpDTO empDto) {

        return userComplaintService.pageComplaint(empDto, con);
    }

    @PostMapping("/pageStrongComplaint")
    @Operation(description = "分页用户投诉")
    @CheckEmpLogin
    public PageDTO<StrongComplaintVO> pageStrongComplaint(@RequestBody @Valid UserComplaintCondition.PageStrongComplaintCon con,
                                                          @StageLoginEmp StageEmpDTO empDto) {
        return userComplaintService.pageStrongComplaint(empDto, con);
    }

    @GetMapping("/disComplaint")
    @Operation(description = "接入处理")
    @CheckEmpLogin
    public void disComplaint(@RequestParam String complaintNo,
                             @StageLoginEmp StageEmpDTO empDto) {
        userComplaintService.disComplaint(empDto, complaintNo);
    }

    @PostMapping("/disComplaintOk")
    @Operation(description = "处理完成")
    @CheckEmpLogin
    public void disComplaintOk(@RequestBody @Valid UserComplaintCondition.DisComplaintOkCon con,
                             @StageLoginEmp StageEmpDTO empDto) {
        userComplaintService.disComplaintOk(empDto, con);
    }


}
